from redis import StrictRedis


class Config:
    DEBUG = True
    # 设置密钥
    SECRET_KEY = b'3faZJoMJS1MsC1aG0zQixQfXDhUsL5vKU2WzJpqjZCY='
    # 配置数据库地址
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost:3306/info2'
    # 设置动态追踪为不运行
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # 配置Session参数
    # 设置动态可变的地址端口参数
    REDIS_HOST = 'localhost'
    REDIS_PORT = 6379
    # 确定session存储位置
    SESSION_TYPE = 'redis'
    # 确定存储到哪个redis
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    # 设置过期时间
    PERMANENT_SESSION_LIFETIME = 86400


class DevelopmentConfig(Config):
    DEBUG = True


class ProductionConfig(Config):
    DEBUG = False


config = {
    'development': DevelopmentConfig,
    'production': ProductionConfig
}
